package com.zs.toolbox.web2j.system.core.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zs.toolbox.web2j.common.domain.WtBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户基本信息表
 * </p>
 *
 * @author eric.zhang
 * @since 2018-09-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_user")
@ApiModel(value="WtUserEntity对象", description="用户基本信息")
public class WtUserEntity extends WtBaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "登陆名")
    @TableField("username")
    @Pattern(regexp = "[a-zA-Z][0-9a-zA-Z_]{5,19}",message = "用户名应以字母开头,用6-20位字母，数字，下划线")
    @NotBlank
    private String username;

    @ApiModelProperty(value = "密码")
    @TableField("password")
    @JsonIgnore
    private String password;

    @TableField("email")
    private String email;

    @TableField("phone")
    private String phone;

    @ApiModelProperty(value = "昵称")
    @TableField("nickname")
    private String nickname;

    @ApiModelProperty(value = "头像地址")
    @TableField("avastart")
    private String avastart;

    @TableField("user_type")
    @ApiModelProperty(value = "用户类型 1普通用户 2.运营用户",required = false,example = "1")
    @JsonIgnore
    private Integer userType = 1;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonIgnore
//    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "是否有效  1有效  2无效",example = "1")
    @TableField("delete_status")
    @TableLogic
    @JsonIgnore
    private Integer deleteStatus;

@TableField(value = "create_user", fill = FieldFill.INSERT)
    @JsonIgnore
    private Integer createUser;

    @ApiModelProperty(value = "更新时间")
    @JsonIgnore
    @TableField(value = "update_time", update = "now()", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


}
